﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Localization;

namespace EAMF.Content.Items.Accessory
{
    [AutoloadEquip(EquipType.Wings)]
    public class Hidehoverboard : ModItem
    {
        public override void SetStaticDefaults()
        {
            ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(180, 8, 4.5f, true, 16, 16);
        }
        public override void SetDefaults()
        {
            Item.accessory = true;
            Item.rare = ItemRarityID.Cyan;
            Item.defense = 1;

            base.SetDefaults();
        }

        //public override bool pred
        // UpdateAccessory is called every frame when the player is wearing the accessory
        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            //player.wingTime = 0;//this is the time that the player has remaining flight time

            player.lifeRegen += 100;  /// increase life regen by 2
            player.GetDamage(DamageClass.Ranged) *= 0.1f;  /// increase ranged damage by 10%
            player.GetAttackSpeed(DamageClass.Melee) *= -0.1f; /// decrease melee attack speed by 10%
            player.statLifeMax += 100; //increase life by 100
            player.immuneAlpha += 5;
            base.UpdateAccessory(player, hideVisual);
        }

        /*
         * 控制垂直飞行的函数
         * maxcanAscendMultiplier: 使用你跳跃或者上升时的速度，取最大的那个值
         * maxAscentMultiplier:最大爬升率
         * constantAscend: 正常爬升速度
         */
        public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend)
        {
            //ascentWhenFalling = 0.5f;
            //ascentWhenRising = 0.5f;
            //maxCanAscendMultiplier = 1f;
            //maxAscentMultiplier = 10f;
            //constantAscend = 20f;
            base.VerticalWingSpeeds(player, ref ascentWhenFalling, ref ascentWhenRising, ref maxCanAscendMultiplier, ref maxAscentMultiplier, ref constantAscend);
        }
        /*
         * 控制水平飞行的函数
         */
        public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration)
        {
            speed = 10f;
            acceleration = 10f;
            base.HorizontalWingSpeeds(player, ref speed, ref acceleration);
        }
    }
}
